<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Configuring the SQL Interface</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" />
    <link rel="up" href="build_unix.html" title="Chapter 7.  Building Berkeley DB for UNIX/POSIX" />
    <link rel="prev" href="build_unix_conf.html" title="Configuring Berkeley DB" />
    <link rel="next" href="build_unix_small.html" title="Building a small memory footprint library" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Configuring the SQL
        Interface</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="build_unix_conf.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 7.  Building Berkeley DB for UNIX/POSIX
    </th>
          <td width="20%" align="right"> <a accesskey="n" href="build_unix_small.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="build_unix_sql"></a>Configuring the SQL
        Interface</h2>
          </div>
        </div>
      </div>
      <div class="toc">
        <dl>
          <dt>
            <span class="sect2">
              <a href="build_unix_sql.html#config_sql">Changing Compile Options</a>
            </span>
          </dt>
          <dt>
            <span class="sect2">
              <a href="build_unix_sql.html#idm140188018126512">Enabling Extensions</a>
            </span>
          </dt>
          <dt>
            <span class="sect2">
              <a href="build_unix_sql.html#build_unix_jdbc">Building the JDBC Driver</a>
            </span>
          </dt>
          <dt>
            <span class="sect2">
              <a href="build_unix_sql.html#idm140188018072496">Using the JDBC Driver</a>
            </span>
          </dt>
          <dt>
            <span class="sect2">
              <a href="build_unix_sql.html#idm140188018034496">Building the ODBC Driver</a>
            </span>
          </dt>
          <dt>
            <span class="sect2">
              <a href="build_unix_sql.html#bfile">Building the BFILE extension</a>
            </span>
          </dt>
        </dl>
      </div>
      <p> 
        There are a set of options you can provide to
        <span class="command"><strong>configure</strong></span> in order to control how the
        Berkeley DB SQL interface is built. These configuration
        options include: 
    </p>
      <div class="variablelist">
        <dl>
          <dt>
            <span class="term">--disable-log-checksum</span>
          </dt>
          <dd> Disables checksums in log records. This
                provides a boost to performance at the risk of log
                files having undetectable corruption that could
                prevent proper data recovery in case of database
                corruption. 
            <p>
                    Note that while this option is meant for use
                    with the SQL interface, it will also disable
                    checksum for the non-SQL interfaces. 
                </p></dd>
          <dt>
            <span class="term">--enable-sql</span>
          </dt>
          <dd>
                Causes the <span class="command"><strong>dbsql</strong></span> command
                line interpreter to be built. Along with
                <span class="command"><strong>dbsql</strong></span>, this argument also
                builds the libdb_sqlXX.{so|la} library, a C API
                library that mirrors the SQLite C API. 
            </dd>
          <dt>
            <span class="term">--enable-sql_compat</span>
          </dt>
          <dd>
            <p> 
                    Causes the <span class="command"><strong>sqlite3</strong></span> command
                    line tool to be built. This tool is identical to
                    the <span class="command"><strong>dbsql</strong></span> command line tool,
                    except that it has the same name as the command
                    line tool that comes with standard SQLite. 
                </p>
            <p> 
                    In addition, the libsqlite3.{so|la} C API
                    library is built if this option is specified. This
                    library is identical to the libdb_sqlXX.{so|la}
                    library that is normally built for Berkeley DB's
                    sql interface, except that it has the same name as
                    the library which is built for standard SQLite. 
                </p>
            <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
              <h3 class="title">Warning</h3>
              <p> 
                        Use this compatibility option with
                        <span class="emphasis"><em>extreme</em></span> care.
                        Standard SQLite is used by many programs and
                        utilities on many different platforms. Some
                        platforms, such as Mac OS X, come with
                        standard SQLite built in because default
                        applications for the platform use that
                        library.
                    </p>
              <p>
                        <span class="bold"><strong>Use of this option on
                        platforms where standard SQLite is in
                        production use can cause unexpected
                        runtime errors either for your own
                        application, or for applications and
                        utilities commonly found on the platform,
                        depending on which library is found first
                        in the platform's library search
                        path.</strong></span>
                    </p>
              <p> 
                        Use this option <span class="emphasis"><em>only</em></span>
                        if you know exactly what you are doing.
                    </p>
            </div>
            <p>
                    This option is provided so that there is an
                    easy upgrade path for legacy SQLite tools and
                    scripts that want to use BDB SQL without rewriting
                    the tool or script. However, data contained in
                    standard SQLite databases must be manually
                    migrated from the old database to your BDB SQL
                    database even if you use this option. See the
                    <em class="citetitle">Berkeley DB Getting Started with the SQL APIs</em> guide for
                    information on migrating data from standard SQLite
                    to BDB SQL databases.
                </p>
            <p> 
                    Note that in addition to the renamed command
                    line tool and library, this option also causes
                    versions of the command line tool and library to
                    be built that use the normal BDB SQLite names
                    (<span class="command"><strong>dbsql</strong></span> and
                    libdb_sqlXX.{so|la}). 
                </p>
          </dd>
          <dt>
            <span class="term">--enable-test</span>
          </dt>
          <dd>
                Cause the Berkeley DB SQL interface test suite
                to be built. This argument can also be used with
                either <code class="literal">--enable-sql</code> or
                <code class="literal">--enable-sql_compat</code> to build
                the SQLite Tcl test runner. 
            </dd>
          <dt>
            <span class="term">--enable-jdbc</span>
          </dt>
          <dd>
            <p> 
                    Causes the JDBC driver to be built. Setting
                    this option implies that
                    <code class="literal">--enable-sql</code> is set, which
                    means that the Berkeley DB SQL API will be built
                    too.
                </p>
          </dd>
          <dt>
            <span class="term">--with-cryptography</span>
          </dt>
          <dd>
            <p>
                    Enables encryption support for the Berkeley DB
                    SQL interface. See <a href="../bdb-sql/sql_encryption.html" class="olink">SQL Encryption</a> in the
                    <em class="citetitle">Berkeley DB Getting Started with the SQL APIs</em> guide for
                    usage details. 
                </p>
          </dd>
        </dl>
      </div>
      <p> 
        The following configuration options are useful when
        debugging applications:
    </p>
      <div class="variablelist">
        <dl>
          <dt>
            <span class="term">
                <a class="link" href="build_unix_conf.html#build_unix_conf.--enable-debug">--enable-debug</a>
            </span>
          </dt>
          <dd>
                Builds the Berkeley DB SQL interface with debug
                symbols.
            </dd>
          <dt>
            <span class="term">
                <a class="link" href="build_unix_conf.html#build_unix_conf.--enable-diagnostic">--enable-diagnostic</a>
            </span>
          </dt>
          <dd>
                Builds the Berkeley DB SQL interface with
                run-time debugging checks.
            </dd>
        </dl>
      </div>
      <p> 
        Any arguments that you can provide to the standard SQLite
        configure script can also be supplied when configuring
        Berkeley DB SQL interface. 
    </p>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="config_sql"></a>Changing Compile Options</h3>
            </div>
          </div>
        </div>
        <p>
            There are several configuration options you can specify
            as an argument to the configure script using the standard
            environment variable, CFLAGS. For example, to configure
            with the option BDBSQL_FILE_PER_TABLE, do the
            following:
        </p>
        <pre class="programlisting">$ ../dist/configure --enable-sql CFLAGS="-DBDBSQL_FILE_PER_TABLE=1"</pre>
        <div class="variablelist">
          <dl>
            <dt>
              <span class="term">BDBSQL_DEFAULT_PAGE_SIZE</span>
            </dt>
            <dd> 
                    To set the default page size when you
                    create a database, specify the
                    BDBSQL_DEFAULT_PAGE_SIZE flag. The value assigned
                    must be a 0, 512, 1024, 2048, 4096, 8192 16384,
                    32768, or 65536. The default value is 4096. If the
                    value is set to zero, Berkeley DB queries the file
                    system to determine the best page size, and the
                    value of SQLITE_DEFAULT_PAGE_SIZE is used to
                    calculate the cache size, as the cache size is
                    specified as a number of pages.
                </dd>
            <dt>
              <span class="term">BDBSQL_FILE_PER_TABLE</span>
            </dt>
            <dd>
                    To generate each table in a separate file,
                    rather than as subdatabases in a single file,
                    specify the BDBSQL_FILE_PER_TABLE flag. When this
                    option is enabled, the SQL database name is used
                    as a directory name. This directory contains one
                    file for the metadata and one file each for every
                    table created by the SQL API. Note that adding or
                    deleting files from the database directory may
                    corrupt your database. To backup the metadata
                    (schema), make a copy of the
                    <code class="literal">metadata</code> and
                    <code class="literal">table00001</code> files from the
                    database directory. Make a new copy whenever the
                    schema is changed.
                </dd>
            <dt>
              <span class="term">BDBSQL_LOG_REGIONMAX</span>
            </dt>
            <dd>
                    To configure the log region size for the
                    underlying storage engine, specify the
                    BDBSQL_LOG_REGIONMAX flag. For more information,
                    see <a href="../api_reference/C/envget_lg_regionmax.html" class="olink">DB_ENV-&gt;get_lg_regionmax()</a>.
                </dd>
            <dt>
              <span class="term">BDBSQL_OMIT_LEAKCHECK </span>
            </dt>
            <dd>
                    For Berkeley DB to use the default system
                    allocation routines rather than the SQLite
                    allocation routines, specify the
                    BDBSQL_OMIT_LEAKCHECK flag.
                </dd>
            <dt>
              <span class="term">BDBSQL_OMIT_LOG_REMOVE </span>
            </dt>
            <dd>
                    Berkeley DB automatically removes log files
                    that are not required any more, that is, files
                    that are older than the most recent checkpoint. To
                    disable this functionality, specify the
                    BDBSQL_OMIT_LOG_REMOVE flag. It is necessary to
                    provide this flag if you are using replication
                    with Berkeley DB SQL. 
                </dd>
            <dt>
              <span class="term">BDBSQL_OMIT_SHARING </span>
            </dt>
            <dd>
                    To create a private environment rather than
                    a shared environment, specify the
                    BDBSQL_OMIT_SHARING flag. That is, the cache and
                    other region files will be created in memory
                    rather than using file backed shared memory. For
                    more information, see the DB_PRIVATE flag of
                    <a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a>.
                </dd>
            <dt>
              <span class="term">BDBSQL_SINGLE_THREAD </span>
            </dt>
            <dd>
                    To disable locking and thread safe
                    connections, specify the BDBSQL_SINGLE_THREAD
                    flag. If an application is going to use Berkeley
                    DB from a single thread and a single process,
                    enabling this flag can deliver significant
                    performance advantages. 
                </dd>
            <dt>
              <span class="term">SQLITE_DEFAULT_CACHE_SIZE </span>
            </dt>
            <dd>
                    SQLite provides an in-memory cache which you
                    size according to the maximum number of database
                    pages that you want to hold in memory at any given
                    time. Berkeley DB's in-memory cache feature
                    performs the same function as SQLite. To specify
                    the suggested maximum number of pages of disk
                    cache that will be allocated per open database
                    file specify the SQLITE_DEFAULT_CACHE_SIZE flag.
                    Default value is 2000 pages. For more information,
                    see the SQLite documentation on <a class="ulink" href="http://www.sqlite.org/pragma.html#pragma_default_cache_size" target="_top">
                    PRAGMA default_cache_size</a>.
                </dd>
            <dt>
              <span class="term">SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT </span>
            </dt>
            <dd>
                    For SQLite, this pragma identifies the
                    maximum size that the journal file is allowed to
                    be. Berkeley DB does not have a journal file, but
                    it writes and uses log files. A new log file is
                    created when the current log file has reached the
                    defined maximum size. To define this maximum size
                    for a log file, specify the
                    SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT flag. Default
                    value is 10 MB for the Berkeley DB SQL interface.
                </dd>
          </dl>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idm140188018126512"></a>Enabling Extensions</h3>
            </div>
          </div>
        </div>
        <p> 
            The Berkeley DB SQL API provides extensions such as full text
            search, R-Tree index, user authentication and key-store based
            user authentication. By default, these extensions are disabled.
            To enable an extension in the Berkeley DB SQL interface,
            specify the related option as an argument to the configure
            script using the standard environment variable, CPPFLAGS.
         </p>
        <div class="variablelist">
          <dl>
            <dt>
              <span class="term">SQLITE_ENABLE_FTS3</span>
            </dt>
            <dd>
                    Enable building the Berkeley DB full text search layer. 
                </dd>
            <dt>
              <span class="term">SQLITE_ENABLE_RTREE</span>
            </dt>
            <dd>Enables the Berkeley DB R-Tree layer.
              </dd>
            <dt>
              <span class="term">BDBSQL_USER_AUTHENTICATION</span>
            </dt>
            <dd>
                    Enables the Berkeley DB user authentication module.
                    BDB encryption must also be enabled.
                </dd>
            <dt>
              <span class="term">BDBSQL_USER_AUTHENTICATION_KEYSTORE</span>
            </dt>
            <dd>
                    Enables the Berkeley DB key-store based user
                    authentication module. BDB encryption must
                    also be enabled. 
                </dd>
          </dl>
        </div>
        <p> 
            See the SQLite Documentation for more information on
            <a class="ulink" href="http://www.sqlite.org/fts3.html" target="_top">
            Full Text Search</a> and  
            <a class="ulink" href="http://www.sqlite.org/rtree.html" target="_top">R-Tree</a>.
         </p>
        <p>
                For more information on user authentication and key-store based user
                authentication, see <em class="citetitle">Berkeley DB Getting Started with the SQL APIs</em>.
         </p>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="build_unix_jdbc"></a>Building the JDBC Driver</h3>
            </div>
          </div>
        </div>
        <p> 
            This section describes how to build the JDBC driver
            code using <code class="literal">autoconf</code>, which is the only
            method supported and tested by the Berkeley DB team. 
        </p>
        <p> 
            To build the JDBC driver, you must have Sun Java
            Development Kit 1.1 or above installed.
        </p>
        <pre class="programlisting">cd build_unix
    ../dist/configure --enable-jdbc --prefix=&lt;install path&gt;
    make install</pre>
        <p>
            You can test the build by entering the following
            commands from the <code class="literal">build_unix/jdbc</code>
            directory: 
        </p>
        <table class="simplelist" border="0" summary="Simple list">
          <tr>
            <td>javac -classpath ./sqlite.jar test3.java</td>
          </tr>
          <tr>
            <td>java -Djava.library.path=./.libs -classpath
                ./sqlite.jar:. test3 </td>
          </tr>
        </table>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idm140188018072496"></a>Using the JDBC Driver</h3>
            </div>
          </div>
        </div>
        <p>
               This section describes how to download, build, and run
               sample programs using the built JDBC driver.
        </p>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm140188018071696"></a>Downloading JDBC Sample Code</h4>
              </div>
            </div>
          </div>
          <p>
                The download link for JDBC sample code is available
                on the <a class="ulink" href="http://www.oracle.com/technetwork/java/index-139949.html" target="_top"> 
                Oracle Technology Network (OTN) </a> page.
                You can identify the link by the "JDBC programming
                examples from all three editions (ZIP format)" text
                beside it. 
            </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm140188018094288"></a>Modifying Sample Code</h4>
              </div>
            </div>
          </div>
          <p>
                Before running the example code, do the following: 
            </p>
          <div class="orderedlist">
            <ol type="1">
              <li> 
                    Unzip the file containing the sample code
                    to a new directory (for example, jdbc_ex). 
                </li>
              <li>
                <p> 
                        Substitute
                        <code class="literal">jdbc:sqlite:/&lt;db-file-name&gt;</code>
                        for the generic JDBC URL that appears in the
                        code. That is, put
                        <code class="literal">jdbc:sqlite:/&lt;db-file-name&gt;</code>
                        between the quotation marks in the line: 
                    </p>
                <p>
                        <code class="literal">String url =
                        "jdbc:mySubprotocol:myDataSource";</code>
                    </p>
                <p> 
                        Note: The &lt;db-file-name&gt; can either
                        be an absolute path name like
                        <code class="literal">"jdbc:sqlite://jdbc_ex_db/myDataSource"</code>,
                        or a relative path-file-name like
                        <code class="literal">"jdbc:sqlite:/../jdbc_ex_db/myDataSource"</code>,
                        or a file name, like
                        <code class="literal">"jdbc:sqlite:/myDataSource"</code>,
                        in which case the database file will be stored
                        at the current directory. Note that all path
                        arguments require a leading slash, even in the
                        case of relative paths or a database in the
                        local directory. Please refer to the above
                        examples.
                    </p>
              </li>
              <li>
                        Substitute
                        <code class="literal">SQLite.JDBCDriver</code> for
                        <code class="literal">myDriver.ClassName</code> in the
                        line:
                        <code class="literal">Class.forName("myDriver.ClassName");</code></li>
              <li>
                <p>
                        Optionally substitute the username and
                        password you use for your database in the
                        following: <code class="literal">"myLogin",
                        "myPassword"</code>.
                    </p>
              </li>
              <li> 
                    If your JDK version is above 1.5, change
                    the variable name <code class="literal">enum</code> in
                    <code class="literal">OutputApplet.java</code> to some
                    other variable name because, as of JDK release 5
                    <code class="literal">enum</code> is a keyword and can
                    not be used as an identifier. 
                </li>
            </ol>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm140188018079056"></a>Building and Running the JDBC Sample code</h4>
              </div>
            </div>
          </div>
          <p> 
                See <a class="xref" href="build_unix_sql.html#build_unix_jdbc" title="Building the JDBC Driver">Building the JDBC Driver</a> for instructions
                on building the JDBC driver. 
            </p>
          <p> 
                To build and run the JDBC examples do the
                following: 
            </p>
          <div class="orderedlist">
            <ol type="1">
              <li>
                    Copy
                    <code class="literal">build_unix/jdbc/sqlite.jar</code>
                    and
                    <code class="literal">build_unix/jdbc/.libs/libsqlite_jni.so</code>
                    to the <code class="literal">jdbc_ex</code> directory. 
                </li>
              <li>
                <p> 
                        In the <code class="literal">jdbc_ex</code>
                        directory, run the following commands:
                    </p>
                <pre class="programlisting">$ javac -classpath ./sqlite.jar *.java
    $ java -classpath .:sqlite.jar -Djava.library.path=. \
    &lt;ClassName, eg. CreateCoffees&gt;</pre>
              </li>
              <li> 
                    After you run the CreateCoffees example,
                    use the <code class="literal">dbsql</code> executable to
                    open the <code class="literal">myDataSource</code> database
                    file and check if the table
                    <code class="literal">COFFEES</code> has been
                    successfully created in the database.
                    <pre class="programlisting">$ dbsql myDataSourcedbsql&gt; .tables
    COFFEES
    dbsql&gt; .dump
    PRAGMA foreign_keys=OFF;
    BEGIN TRANSACTION;
    CREATE TABLE COFFEES (COF_NAME varchar(32),\
    SUP_ID int, PRICE float, SALES int, TOTAL int);
    COMMIT;
    dbsql&gt;</pre></li>
              <li>
                <p>
                        Repeat step 3 to run other examples.
                    </p>
                <p>
                        Note: Some examples, such as AutoGenKeys,
                        are not yet supported by BDB JDBC driver. The
                        <code class="literal">SQLFeatureNotSupportedException</code>
                        is displayed for those unsupported examples.
                    </p>
              </li>
            </ol>
          </div>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idm140188018034496"></a>Building the ODBC Driver</h3>
            </div>
          </div>
        </div>
        <p> 
            This section describes how to build the ODBC driver.
        </p>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm140188018046848"></a>Configuring Your System</h4>
              </div>
            </div>
          </div>
          <p>
                To configure your system prior to building the ODBC
                driver, do the following: 
            </p>
          <div class="orderedlist">
            <ol type="1">
              <li>
                    Download and install the latest <a class="ulink" href="http://www.unixodbc.org" target="_top">unixODBC</a>
                    if ODBC is not already installed on your system.
                </li>
              <li> 
                    Configure the ODBC server to work with
                    SQLite databases. Follow <a class="ulink" href="http://www.ch-werner.de/sqliteodbc/html/index.html" target="_top">
                    these instructions</a> from Christian
                    Werner. 
                </li>
            </ol>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm140188018025248"></a>Building the Library</h4>
              </div>
            </div>
          </div>
          <p> 
                To build the library without encryption, do the following: 
            </p>
          <pre class="programlisting">
    $ cd db-6.2.XX/build_unix
    $ CFLAGS="-fPIC" ../dist/configure --enable-sql_compat --disable-shared
    $ make
    $ cd ../lang/sql/odbc
    $ CFLAGS="-D_HAVE_SQLITE_CONFIG_H \
              -I../../../build_unix -I../../../build_unix/sql \
              -I../../../src/dbinc -I../sqlite/src -I../../../src" \
              LDFLAGS="../../../build_unix/libdb-6.2.a" \
             ./configure --with-sqlite3=../generated
    $ make</pre>
          <p> 
                To build the library with encryption, do the following: 
            </p>
          <pre class="programlisting">
    $ cd db-6.2.XX/build_unix
    $ CFLAGS="-fPIC" ../dist/configure --enable-sql_compat \
	      --disable-shared --with-cryptography=yes
    $ make
    $ cd ../lang/sql/odbc
    $ CFLAGS="-D_HAVE_SQLITE_CONFIG_H -DSQLITE_HAS_CODEC=1 \
              -I../../../build_unix -I../../../build_unix/sql \
              -I../../../src/dbinc -I../sqlite/src" \
              LDFLAGS="../../../build_unix/libdb-6.2.a" \
             ./configure --with-sqlite3=../generated
    $ make</pre>
          <p>
                The <code class="literal">libsqlite3odbc.so</code> library
                containing a statically linked version of Berkeley DB
                SQL is now built.
            </p>
          <p>
                NOTE: The final <code class="literal">make</code> command
                above is known to generate a warning when using GCC.
                The warning states: <code class="literal">Warning: Linking the
                shared library libsqlite3odbc.la against the
                static library
                ../../build_unix/libdb-6.2.a is not
                portable!</code>. It is generally safe to
                ignore the warning when using the generated library.
            </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm140188018019488"></a>Testing the ODBC Driver</h4>
              </div>
            </div>
          </div>
          <p>
                The steps to verify that the installed driver works
                are as follows:
            </p>
          <div class="orderedlist">
            <ol type="1">
              <li> 
                    Alter the
                    <code class="literal">/etc/odbcinst.ini</code> and
                    <code class="literal">~/.odbc.ini</code> configuration
                    files to refer to the libsqlite3odbc.so file built
                    above.
                </li>
              <li>
                <p> 
                        Create a data source, and launch a data
                        source viewer application by doing the
                        following:
                    </p>
                <pre class="programlisting">$ mkdir ~/databases
    $ cd ~/databases
    $ /path/to/Berkeley DB/build_unix/sqlite3 mytest.db
    dbsql&gt; CREATE TABLE t1(x);
    dbsql&gt; .quit
    $ odbcinst -m </pre>
                <p> 
                        The final step opens a GUI application that
                        displays ODBC data sources on a system. You
                        should be able to find the
                        <code class="literal">mytest.db</code> data source
                        just created.
                    </p>
              </li>
            </ol>
          </div>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="bfile"></a>Building the BFILE extension</h3>
            </div>
          </div>
        </div>
        <p> 
            The BFILE extension allows you to store binary files
            outside of the database, but still operate upon them as if
            they were stored within the database. To enable this
            extension, use the
            <code class="literal">--enable-load-extension</code>
            configuration flag. For example:
        </p>
        <pre class="programlisting">$ cd &lt;db&gt;/build_unix
$ export DBSQL_DIR=$PWD/../install
$ ../dist/configure --enable-sql --enable-load-extension \
     --prefix=$DBSQL_DIR &amp;&amp; make &amp;&amp; make install
$ cd ../lang/sql/sqlite/ext/bfile/build
$ make &amp;&amp; make install</pre>
        <p>
            BFILE extensions are only supported for Unix platforms.
        </p>
        <p>
            Note that the extension support has two interfaces: SQL
            expressions and a C-functions API. By default, the SQL
            expressions are built when you use
            <code class="literal">--enable-load_extension</code>. To use the
            C-functions API, edit
            <code class="literal">&lt;db&gt;/lang/sql/ext/bfile/build/Makefile</code>
            and set <code class="literal">ENABLE_BFILE_CAPI</code> to
            <code class="literal">1</code>. 
        </p>
        <p> 
            Once you have enabled the extension and built the
            library, you can run the included example: 
        </p>
        <pre class="programlisting">$ cd lang/sql/sqlite/ext/bfile/build
$ export LD_LIBRARY_PATH=$PWD:$DBSQL_DIR/lib
$ ./bfile_example_sql     # for SQL expressions interface
$ ./bfile_example_capi    # for C-functions API</pre>
        <p> 
            For more information on using the BFILE extension, see
            the <em class="citetitle">Berkeley DB Getting Started with the SQL APIs</em> guide.
        </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="build_unix_conf.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="build_unix.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="build_unix_small.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Configuring Berkeley DB </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Building a small memory footprint library</td>
        </tr>
      </table>
    </div>
  </body>
</html>
